package com.lc.afbx.activity;

import android.Manifest;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.ViewGroup;

import com.lc.afbx.BaseApplication;
import com.lc.afbx.util.UtilPermission;
import com.zcx.helper.activity.AppV4Activity;
import com.zcx.helper.bound.BoundViewHelper;

/**
 * Created by Administrator on 2016/3/14.
 */
public class BaseActivity extends AppV4Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        UtilPermission.Permission(this,
                Manifest.permission.INTERNET,
                Manifest.permission.WRITE_SETTINGS,
                Manifest.permission.SYSTEM_ALERT_WINDOW,
                Manifest.permission.CHANGE_NETWORK_STATE,
                Manifest.permission.VIBRATE,
                Manifest.permission.INTERNET,
                Manifest.permission.RECORD_AUDIO,
                Manifest.permission.CAMERA,
                Manifest.permission.ACCESS_NETWORK_STATE,
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.GET_TASKS,
                Manifest.permission.WAKE_LOCK,
                Manifest.permission.MODIFY_AUDIO_SETTINGS,
                Manifest.permission.ACCESS_WIFI_STATE,
                Manifest.permission.READ_EXTERNAL_STORAGE,
                Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS,
                Manifest.permission.READ_PHONE_STATE,
                Manifest.permission.ACCESS_COARSE_LOCATION,
                Manifest.permission.ACCESS_FINE_LOCATION,
                Manifest.permission.CHANGE_WIFI_STATE,
                Manifest.permission.RECEIVE_BOOT_COMPLETED,
                Manifest.permission.CALL_PHONE);


        BaseApplication.INSTANCE.addActivity(this);

    }

    @Override
    public void setContentView(int layoutResID) {

        super.setContentView(layoutResID);

        BoundViewHelper.boundView(this, BaseApplication.ScaleScreenHelper.loadView((ViewGroup) getWindow().getDecorView()));

    }

    @Override
    public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
        super.onSaveInstanceState(outState, outPersistentState);
    }

    @Override
    protected void onDestroy() {

        super.onDestroy();

        BaseApplication.INSTANCE.finishActivity(this);

    }


}
